/*function Render(obj,root){
    const el = document.createElement(obj.tag)
    if (typeof obj.children === 'string') {
        const text = DocumentFragment.createTextNode(obj.children)
        el.appendChild(text)
    }
    else if (obj.children) {
        //数组，递归调用Render,使用el 作为root参数
        obj.children.forEach((child) => Render(child,el))
    } 
    //将元素添加到root
    root.appendChild(el)
}*/
//创建一个Person函数有三个参数name age job
//给一个指针指向Person
//创建两个实例对象Nicholas 29 Software Engineer  Greg 27 Doctor
// function Person(name,age,job){
//     this.name = name
//     this.age = age
//     this.job =job
//     this.sayName =SayName
// }
// function SayName (){
//     console.log(this.name)
// }
// let  person1 = new Person('Nicholas',29,'Software Engineer')
// let  person2 = new Person('greg',27,'doctor')
// person1.sayName()
// person2.sayName()

//写一个空函数 使用Person原型链上的prototype属性 Name age  job
//声明一个原型链上的sayName函数
//new两个新对象使用sayname属性
// 打印1，2的sayName属性是否是一个
// let Person = function () {}
// Person.prototype.Name = "Nicholas";
// Person.prototype.age = "29";
// Person.prototype.job = "Software Engineer";
// Person.prototype.sayName = function(){
//     console.log(this.Name)
// }

// let Person1 = new Person (); 
// Person1.sayName();
// let Person2 = new Person();
// Person2.sayName();
// console.log(Person1.sayName == Person2.sayName)

//创建biped、person对象 有numbegs:2 使用Object.create()方法创造person对象
// let biged = {
//     numbegs:2
// }
// let person = Object.create(biged)
// console.log(person.numbegs)
// console.log(Object.getPrototypeOf(person)===biged)


//给一个构造函数 对象原型链上的是 name age job sayName(函数) 两个实例一个实例name改为ok
//  function Person(){}
//  Person.prototype.name = 'Nike'
//  Person.prototype.age = '29'
//  Person.prototype.job = "software Engineer"
//  Person.prototype.SayName = function(){
// console.log(this.name)
//  }
//  let person1 = new Person
//  let person2 = new Person
//  person1.name = "adidas "
//  console.log(person1.name)
//  console.log(person2.name)

// function hasPrototypeProperty(object,name){
//     return !object.hasOwnProtoperty(name)&&(name in object)
// }